-module(hub_im_admin_app).
-behaviour(application).

-export([start/2]).
-export([stop/1]).

start(_Type, _Args) ->
	Dispatch = cowboy_router:compile([
		{'_', [
			{"/", login_handler, []},
			{"/index/[...]", login_handler, []},
			{"/logout/[...]", logout_handler, []},
%%			用户,会话,消息管理
			{"/cusUserPrepareDetail/[...]", cus_user_handler, []},
			{"/cusUserDetail/[...]", cus_user_handler, []},
			{"/cusConversationPrepareDetail/[...]", cus_conversation_handler, []},
			{"/cusConversationDetail/[...]", cus_conversation_handler, []},
			{"/cusMessagePrepareDetail/[...]", cus_message_handler, []},
			{"/cusMessageList/[...]", cus_message_handler, []},
			{"/cusMessageDetail/[...]", cus_message_handler, []},
%%			表情包管理
			{"/cusEmotionPacketList/[...]", cus_emotion_packet_list_handler, []},
			{"/cusEmotionPacketPrepareAdd/[...]", cus_emotion_packet_add_handler, []},
			{"/cusEmotionPacketAdd/[...]", cus_emotion_packet_add_handler, []},
			{"/cusEmotionPacketPrepareEdit/[...]", cus_emotion_packet_edit_handler, []},
			{"/cusEmotionPacketEdit/[...]", cus_emotion_packet_edit_handler, []},
%%			表情管理
			{"/cusEmotionPacketDetail/[...]", cus_emotion_packet_detail_handler, []},
			{"/cusEmotionPrepareAdd/[...]", cus_emotion_add_handler, []},
			{"/cusEmotionAdd/[...]", cus_emotion_add_handler, []},
			{"/cusEmotionPrepareEdit/[...]", cus_emotion_edit_handler, []},
			{"/cusEmotionEdit/[...]", cus_emotion_edit_handler, []},
			{"/cusEmotionDelete/[...]", cus_emotion_delete_handler, []},




			{"/ks3DetailOfPNG/[...]", ks3_png_handler, []},
			{"/ks3DetailOfGIF/[...]", ks3_gif_handler, []},

			%% static handlers
			{"/static/[...]", cowboy_static, {priv_dir, hub_im_admin, "static"}}

		]}
	]),
	cowboy:start_http(hub_http_listener, 100, [{port, 8080}],
		[{env, [{dispatch, Dispatch}]}]
	),
	hub_im_admin_sup:start_link().

stop(_State) ->
	ok.
